package com.sias.hello;

import com.sias.hello.service.ChineseService;
import com.sias.hello.service.EnglishService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author 吴文杰
 * @version 1.0
 * @createTime 2023-05-22 19:40:10
 */
@Configuration
@ComponentScan("com.sias.hello")
public class AutoConfigurationHello {

  @Bean
  @ConditionalOnProperty(prefix = "hello.chinese",name = "chineseService",havingValue = "true")
  @ConditionalOnMissingBean(ChineseService.class)
  public ChineseService chineseService(){
    return new ChineseService();
  }

  @Bean
  @ConditionalOnProperty(prefix = "hello.english",name = "englishService",havingValue = "true")
  @ConditionalOnMissingBean(EnglishService.class)
  public EnglishService englishService(){
    return new EnglishService();
  }
}
